package com.cskaoyan.weixin.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.Topic;
import com.cskaoyan.weixin.bean.topic.WxTopicDetailVO;
import com.cskaoyan.weixin.bean.topic.WxTopicListVO;
import com.cskaoyan.weixin.service.WxTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/wx/topic")
public class WxTopicController {

    @Autowired
    WxTopicService wxTopicService;

    @RequestMapping("list")
    public BaseRespVo list(Integer page,Integer size) {
        WxTopicListVO wxTopicListVO = wxTopicService.list(page,size);
        return BaseRespVo.ok(wxTopicListVO);
    }

    @RequestMapping("/detail")
    public BaseRespVo detail(Integer id) {
        WxTopicDetailVO wxTopicDetailVO = wxTopicService.detail(id);
        return BaseRespVo.ok(wxTopicDetailVO);
    }

    @RequestMapping("/related")
    public BaseRespVo related(Integer id){
        List<Topic> topicList = wxTopicService.related(id);
        return BaseRespVo.ok(topicList);
    }
}
